﻿using BussinessObject.ObjectTwo;
using Class_Entity.ObjectTwo;
using ProjectHK3.App_Code;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectHK3.Object_One
{
    public partial class CreateCompany : System.Web.UI.Page
    {
        B_Insert ex = new B_Insert();
        Companies fx = new Companies();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
       
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox6.Text = "";
            TextBox1.Focus();

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            fx.COMPANY_NAME = TextBox2.Text;
            fx.COMPANY_CODE = TextBox1.Text;
            fx.COMPANY_PHONE = TextBox4.Text;
            fx.COMPANY_EMAIL = TextBox5.Text;
            fx.DESCRIPTION = TextBox6.Text;
            fx.COMPANY_ADDRESS = TextBox3.Text;
            if (ex.InsertCompany(fx) == true)
            {
                Response.Redirect("../Object One/Company.aspx");
                Alert.Show("Insert Seccessful!!!");
            }
            else
            {
                Alert.Show("Fail");
            }
        }
    }
}